<?php
namespace app\controller;

use think\facade\Db;

class Member {
    // public function index() {
    //     $data = Db::name('users_type')->select();
    //     return json(['status' => 1, 'data' => $data]);
    // }

    public function index() {
        $page = request()->get('page', 1);
        $limit = 10;
        $offset = ($page - 1) * $limit;

        $data = Db::name('users_type')->limit($offset, $limit)->select();
        $total = Db::name('users_type')->count();

        return json(['status' => 1, 'data' => ['members' => $data, 'total' => $total]]);
    }

    public function users() {
        $page = request()->get('page', 1);
        $limit = 10;
        $offset = ($page - 1) * $limit;

        $data = Db::name('field')->limit($offset, $limit)->select();
        $total = Db::name('field')->count();

        return json(['status' => 1, 'data' => ['users' => $data, 'total' => $total]]);
    }
}
